<cfcomponent output="false">
	<cfset $view = application.v />
	<cfset $service = application.s />
	<cfset $ = application.helpers />
	<cfset popular = "church,education,health,medical" />
	
	<!--- --->

	<cffunction name="renderTagFilter" access="public" output="true" returntype="string">
		
		<cfset var local = {} />

		<cfsavecontent variable="local.result">
			#$view.filterView._renderForm(title="Hashtags",id="tag_filter")#
				<div class="filter-label instructions" bubble="This is the bubble message!." style="margin-bottom:3px;" />
					Active Hashtags
				</div>
				<div class="tag-box" onclick="jQuery('##tag-box-input').focus();">
					<cfif structKeyExists(cookie,'tag')>
						<cfloop list="#cookie.tag#" index="local.i" delimiters="|">
							<cfset local.ispopular = listContainsNoCase(popular,local.i) />
							#$view.fundView._renderFundTag(tag=local.i,filter=true,isAdd=false,popular=local.ispopular)#
						</cfloop>
					</cfif>
					<input id="tag-box-input" value="" validate="" placeholder="Search hashtags" onkeyup="Fund.throttle(Tag.search,'tagSearch',700);" onfocus="jQuery(this).closest('.tag-box').addClass('focused');" onfocusout="jQuery(this).closest('.tag-box').removeClass('focused');"/>
					#$.render.img(id="tag-box-input-loading",path='icons/loading.gif',style="display:none;float:right;margin-top:-14px;margin-right:2px;")#
					<span id="not-found" style="display:none;float:right;margin-top:-17px;margin-right:3px;" class="instructions">Not Found</span>
				</div>
				
				<div class="filter-label instructions" bubble="This is the bubble message!." style="margin-bottom:3px;" />
					Popular Hashtags
				</div>
				<div style="clear:both" id="popular-tag-box">
					<cfloop list="#popular#" index="local.i">
						<cfset local.hide = false />
						<cfif structKeyExists(cookie,'tag') and listContainsNoCase(cookie.tag,local.i,'|')>
							<cfset local.hide = true />
						</cfif>
						#$view.fundView._renderFundTag(tag=local.i,filter=true,isAdd=true,popular=true,hide=local.hide)#
					</cfloop>
				</div>

			#$view.filterView.formClose()#
		</cfsavecontent>
		
		<cfreturn $.render.clean(local.result) />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="renderSearchResults" access="public" output="true" returntype="string">
		<cfargument name="input" required="true" />
		<cfargument name="exclude" required="true" />
		
		<cfset var local = {} />
		
		<cfif arguments.input neq ''>
			<cfset local.results = $service.tagService.searchTags(argumentCollection=arguments) />
		</cfif>		
		
		<cfset local.hasMatch = false />
		
		<cfsavecontent variable="local.result">
			<cfif arguments.input neq ''>
				<cfloop query="local.results">
					<cfset local.isAdd = not local.results.id eq arguments.input />
					#$view.fundView._renderFundTag(tag=local.results.id,filter=true,isAdd=local.isAdd)#
					<cfif not local.isAdd>
						<cfset local.hasMatch = true />
					</cfif>
				</cfloop>
				
				<cfif local.hasMatch>
					<script type="text/javascript">
						$('##tag-box-input').val('');
					</script>
				</cfif>
			</cfif>
		</cfsavecontent>
		
		<cfreturn $.render.clean(local.result) />
		
	</cffunction>
	
	<!--- --->

</cfcomponent>